package com.xy.xylive.xyapi;

import cn.hutool.core.util.StrUtil;
import com.xylink.model.DepModel;
import com.xylink.model.LiveViewerInvited;
import lombok.Data;

import java.util.List;

@Data
public class LiveVideoReq {
    public static final int TITLE_WIDTH = 32;
    public static final int DETAIL_WIDTH = 128;
    public static final int LOCATION_WIDTH = 64;
    private String password;
    private String enterpriseId;
    private String nemoNumber;
    private String confNo;
    private String title;
    private long startTime;
    private long endTime;
    private String detail;
    private boolean autoRecording;
    private boolean autoPublishRecording;
    private String location;
    private String thirdpartyPushURL;
    private LiveViewerInvited liveViewerInvited;
    private String thirdpeoplePushURL;
    private String thirdcontentPushURL;
    private String defaultLiveResolutionType;
    private List<DepModel> deptInvited;
    private String extras;


    public boolean valid() {
        long now = System.currentTimeMillis();
        if (now >= this.startTime) {
            return false;
        } else if (this.startTime >= this.endTime) {
            return false;
        } else if (StrUtil.isBlank(this.title)) {
            return false;
        } else if (this.title.length() > 32) {
            return false;
        } else if (!StrUtil.isBlank(this.detail) && this.detail.length() > 128) {
            return false;
        } else {
            return StrUtil.isBlank(this.location) || this.location.length() <= 64;
        }
    }
}
